package br.com.SAM.Bean;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import br.com.SAM.Interfaces.IGenericBean;


@Stateless
public class GenericBean implements IGenericBean{
	@PersistenceContext(unitName="sam")
	private EntityManager em;
	
	public Object inserir(Object o){
		if(em!=null){
			em.persist(o);
		}
		return o;
	}
	public Object delete(Object o){
		if(em!=null){
			em.remove(o);
		}
		return o;
	}
	
	public void update(Object o){
		em.refresh(o);
	}
	


}
